package com.keffect.effects;


import com.keffect.KEffect;
import com.keffectpanel.KEffectPanel;

/**
 * This class implements an effect that is static, it means that it is a
 * non-animated effect.
 * 
 * 
 * @author Matias Varela
 *         <p>
 *         Student of Licenciatura en Ciencias de la Computacion, at the
 *         Universidad Nacional del Sur (Argentina).
 *         <p>
 *         project site: http://code.google.com/p/keffect-project/
 * 
 */
public abstract class StaticEffect implements KEffect {

	protected boolean isRunning;
	protected KEffectPanel panel;


	public StaticEffect() {
		this.isRunning = false;
	}


	@Override
	public boolean isActive() {
		return isRunning;
	}


	@Override
	public void setEffectPanel(KEffectPanel panel) {
		this.panel = panel;
	}


	@Override
	public KEffectPanel getEffectPanel() {
		return panel;
	}


	@Override
	public void start() {
		if (panel == null) throw new NullPointerException("No KEffectPanel defined for this effect.");
		else {
			initEffectProperties();
			this.isRunning = true;
			if (panel.getParent() != null) panel.getParent().repaint();
		}
	}


	@Override
	public void stop() {
		this.isRunning = false;
	}

}
